﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TetrisByPhillAndRomaCorp
{
    public class GamrRender
    {
      public virtual void RenderField(Field field)
        {
     
            Console.ForegroundColor = ConsoleColor.DarkMagenta;
            for(int i = 0; i < field.lenght; i++)
            {
                Console.SetCursorPosition(i, 0);
                Console.Write('═');
            }

            for (int i = 0; i < field.lenght; i++)
            {
                Console.SetCursorPosition(i, field.width-1);
                Console.Write('═');
            }
           
            for (int i = 0; i < field.width; i++)
            {
                Console.SetCursorPosition(0,i);
                Console.Write('║');
                
                if (i == field.width - 1)
                {
                    Console.SetCursorPosition(0, 0);
                    Console.Write('╔');
                    Console.SetCursorPosition(0,field.width-1);
                    Console.Write('╚');
                }
            }

            for (int i = 0; i < field.width; i++)
            {
                Console.SetCursorPosition(field.lenght-1, i);
                Console.Write('║');

                if (i == field.width - 1)
                {
                    Console.SetCursorPosition(field.lenght-1, 0);
                    Console.Write('╗');
                    Console.SetCursorPosition(field.lenght - 1, field.width - 1);
                    Console.Write('╝');
                }
            }

            Console.ResetColor();
        }
    }
}
